<%@ page language="java" import="org.json.*,java.sql.*,com.microsoft.sqlserver.jdbc.*,java.io.*,web.rec.*" 
contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"  %>

<% 
	Connection conn = ResourceTool.getConnection();
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="script/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="script/form_script.js"></script>
</head>
<body>

            <%
			try {
			// Create the prepared statement and use it to
			// INSERT the student attrs INTO the Student table.
			Statement stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery("SELECT student_id from Student");
			%>
			<table>
				<tr>
					<th>Student ID</th>
					<th>First</th>
					<th>Mid</th>
					<th>Last</th>
					<th>SSN</th>
					<th>Residence</th>
				</tr>
				<tr>
					<form action="StudentClass.jsp" method="get">
						<input type="hidden" value="submit" name="action">
						<td>
						<select id="student_id" name="student_id" onchange= getStudentDetails()>
						<%
							while(rs.next())
							{
						%>
						<option value=<%= rs.getString(1)%>><%= rs.getString(1) %></option>
						<%  } %>
						</select>
						</td>
						<td id = "first_name"></td>
						<td id = "mid_name"></td>
						<td id = "last_name"></td>
						<td id = "ssn"></td>
						<td id = "residence"></td>
						<td><input type="submit" value="submit"></td>
					</form>
				</tr>
			</table>

			<%
			} catch (SQLException sqle) {
				out.println(sqle.getMessage());
			} catch (Exception e) {
				out.println(e.getMessage());
			}    
            %>

</body>
</html>